package com.xcc.annotation.ext.core;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Component
public class Demo01_MyBeanFactoryPostProcess implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        System.out.println("MyBeanFactoryPostProcessor...postProcessBeanFactory...");
        int definitionCount = beanFactory.getBeanDefinitionCount();
        String[] definitionNames = beanFactory.getBeanDefinitionNames();
        System.out.println("beanFactory中一共有 " + definitionCount + " 个bean，分别为: " + Arrays.toString(definitionNames));
    }
}
